package com.foreknow.homework1010;

import java.util.*;

public class test02 {
    public static void main(String[] args) {
        int[] arr = {1, 1, 2, 2, 3, 3, 4};
        System.out.println(Arrays.toString(arr));
        Set<Integer> set = new HashSet<>();
        Map<Integer, Integer> map = new HashMap<>();
        for (Integer i : arr) {
            set.add(i);
        }
        for (Integer i : set) {
            map.put(i, 0);
        }
        for (Integer i : arr) {
            Set<Map.Entry<Integer, Integer>> entry = map.entrySet();
            Iterator<Map.Entry<Integer, Integer>> iterator = entry.iterator();
            while (iterator.hasNext()) {
                Map.Entry<Integer, Integer> map1 = iterator.next();
                Integer key = map1.getKey();
                Integer value = map1.getValue();
                if (i == key) {
                    map.replace(key, value, (value + 1));
                }
            }
        }
        Set<Map.Entry<Integer, Integer>> entry = map.entrySet();
        Iterator<Map.Entry<Integer, Integer>> iterator = entry.iterator();
        while (iterator.hasNext()) {
            Map.Entry<Integer, Integer> map1 = iterator.next();
            Integer key = map1.getKey();
            Integer value = map1.getValue();
            if (value == 1) {
                System.out.println(key);
            }
        }
    }
}
